package org.traffometer.packet;

import java.util.Date;

import junit.framework.TestCase;

import org.traffometer.packet.location.Hemisphere;
import org.traffometer.packet.location.Latitude;
import org.traffometer.packet.location.Location;
import org.traffometer.packet.location.LocationException;
import org.traffometer.packet.location.Longitude;

/**
 * Tests the LocationTimestampPair functionality. 
 *
 * @author Aaron A. Kagawa
 * @version $Id$
 */
public class TestLocationTimestampPair extends TestCase {

  /** 
   * Tests the construction of a LocationTimestampPair object.
   * @throws LocationException If an unexpected problem occurs. 
   */
  public void testConstructor() throws LocationException {
    Longitude longitude = new Longitude(1, 1, 1, Hemisphere.East);
    Latitude latitude = new Latitude(1, 1, 1, Hemisphere.North);
    Location locationOne = new Location(longitude, latitude);
    Date timestampOne = new Date();
    LocationTimestampPair pair = new LocationTimestampPair(locationOne, timestampOne);
    assertEquals("Checking the location of the first pair", locationOne, pair.getLocation());
    assertEquals("Checking the timestamp of the first pair", timestampOne, pair.getTimestamp());
    assertEquals("Checking the toString()", "1 1'1.0'' E, 1 1'1.0'' N, " + timestampOne.toString(), 
        pair.toString());
  }
}